package com.haiyou.sdk.account.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.haiyou.common.http.AbstractController;
import com.haiyou.common.http.HttpResult;
import com.haiyou.protocol.http.sdk.login.AuthRequest;
import com.haiyou.protocol.http.sdk.player.GetDataRequest;
import com.haiyou.protocol.http.sdk.player.GetRankRequest;
import com.haiyou.protocol.http.sdk.player.UpdateDataRequest;
import com.haiyou.sdk.account.AccountService;

/**
 * 
 * 登录相关业务
 * @author xingyuan
 * @Date 2023年6月19日 上午10:15:02
 */
@RestController
public class LoginController extends AbstractController{

	@Autowired
	private AccountService accountService;
	
	/**
	 * 登录接口
	 * @param uid
	 * 
	 * @return
	 */
	@RequestMapping(value = "/login")
	public HttpResult login(@RequestBody AuthRequest request) {
		return accountService.authTokenV1(request);
	}
	
	
	
	/**
	 * 获取玩家数据接口
	 * 
	 * @param token keys多key用逗号分隔
	 */
	@RequestMapping(value = "/getdata")
	public HttpResult getdata(@RequestBody GetDataRequest request) {
		return accountService.getData(request);
	}
	
	/**
	 * 更新玩家数据接口
	 * 
	 * @param token key value
	 * 
	 */
	@RequestMapping(value = "/updatedata")
	public HttpResult updatedata(@RequestBody UpdateDataRequest request) {
		return accountService.updateData(request);
	}
	
	
	
	/**
	 * 获得排行榜接口
	 * 
	 * @param token id 地区id 0表示全国看各省排行榜 140000表示山西看各市排行榜 140100表示太原市看各区排行榜 
	 * 
	 */
	@RequestMapping(value = "/getrank")
	public HttpResult getrank(@RequestBody GetRankRequest request) {
		return accountService.getRank(request);
	}
	
}
